export function getAssetsFile(path: string) {
    return new URL(`../assets/${path}`, import.meta.url).href;
}

// 使用 必须是带有/src 完整目录
//useFile('/src/assets/bg/bg.png');
export const useFile = (url: string) => {
    const modules: Record<string, any> = import.meta.glob(
        '@/assets/images/**/*.{png,svg,jpg,jpeg}',
        { eager: true },
    );
    if (modules[url]) return modules[url].default;
    else {
        // 地址错误
        console.log('Error url is wrong path');
    }
};
